package com.xyz.properties;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * Created by sunny on 2016/12/18.
 * 通过spring-boot解析配置文件对象
 * 可以通过${}获取值
 */
@Component
//获取配置文件application.yml文件前缀是person的属性
@ConfigurationProperties(prefix = "person",locations = "classpath:application.yml")
public class PersonProperties {
    private String name;
    private String sex;
    private Integer age;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }
}
